using System.IO;
using YaAppoint.Localization;
using Volo.Abp.AuditLogging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Validation.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.OpenIddict;
using Volo.Abp.BlobStoring.Database;

namespace YaAppoint;

[DependsOn(
    typeof(AbpAuditLoggingDomainSharedModule),
    typeof(AbpBackgroundJobsDomainSharedModule),
    typeof(AbpFeatureManagementDomainSharedModule),
    typeof(AbpPermissionManagementDomainSharedModule),
    typeof(AbpSettingManagementDomainSharedModule),
    typeof(AbpIdentityDomainSharedModule),
    typeof(AbpOpenIddictDomainSharedModule),
    typeof(BlobStoringDatabaseDomainSharedModule)
    )]
public class YaAppointDomainSharedModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        YaAppointGlobalFeatureConfigurator.Configure();
        YaAppointModuleExtensionConfigurator.Configure();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<YaAppointDomainSharedModule>();
        });


        // ���ػ���Դ����
        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<YaAppointResource>("en") // ���ӱ��ػ���Դ�࣬�Ļ����� "en"
                .AddBaseTypes(typeof(AbpValidationResource))  // 
                .AddVirtualJson("/Localization/YaAppoint");// Json�ļ�ʹ�������ļ�ϵͳǶ�뵽������

            options.DefaultResourceType = typeof(YaAppointResource);// ����Ĭ�ϱ��ػ���Դ����
        });


        // ���ô�����뵽���ػ���Դ��ӳ��
        Configure<AbpExceptionLocalizationOptions>(options =>
        {
            // ����1��  ���ػ������ռ�  ����2:���ػ���Դ�������
            options.MapCodeNamespace("YaAppoint", typeof(YaAppointResource));
        });
    }
}
